<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/platform/include/include.jsp"%>
<%@page import="java.util.UUID"%>
<%
	String uuid = UUID.randomUUID().toString();
%>
<html>
<head>
<TITLE><c:out value="${_LOGONUSER_.MANAGETITILE}" />
</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<%@ include file="/jsp/platform/include/header.jsp"%>
</HEAD>
<BODY>
	<DIV class="all">
		<%@ include file="/jsp/platform/include/head.jsp"%>
		<%@ include file="/jsp/platform/include/menu.jsp"%>
		<DIV class="mains">
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
				<TBODY>
					<TR valign="top">
						<%@ include file="/jsp/platform/include/mainLeft.jsp"%>
						<TD>
							<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
								<TBODY>
									<TR>
										<TD>
											<TABLE width="180" border="0" cellspacing="0" cellpadding="0">
												<TBODY>
													<TR>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_l.jpg">
														</TD>
														<TD align="center"
															background="<%=request.getContextPath()%>/images/pages_bg.jpg">
															<SPAN class="f_tit1">终端分配</SPAN>
														</TD>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_r.jpg">
														</TD>
													</TR>
												</TBODY>
											</TABLE>
										</TD>
									</TR>
								</TBODY>
								<TR>
									<TD>
										<div class="pages_con">
											<div class="pages_con_20">
												<FORM name="terminalInfo" id="terminalInfo" enctype="multipart/form-data"
													action="<%=request.getContextPath()%>/manage/terminalInfo/terminalInfoallot" method="post">
													<DIV class="transaction_external">
														<DIV class="clearfix">
															<SPAN class="fund-item"><SPAN class="label dl_w"
																style="padding-left:20px;text-align:right;">代理商编号：</SPAN>
																<INPUT name="sysAccount" id="sysAccount"
																class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
																type="text" maxlength="30"> <SPAN
																	class="label cz_label"
																	style="width:120px;text-align:right;">终端文件：</SPAN> <INPUT
																	name="file" id="file"
																	class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
																	type="file" maxlength="30">
														</div>
														<div style="overflow:hidden;">
															<A class=" confirm" href="javascript:void(0);"  onclick="$('#downForm').submit();"
																style="margin: 0 0 20px 130px; display:block; float:left;">下载模板</A>
														</div>
														<DIV class="note">
															<SPAN class="label cz_label">&nbsp;</SPAN> <A
																class="btn confirm" href="javascript:void(0);"  onclick="submitForm();"
																style="margin-left:113px;">确定</A>

														</DIV>
													</DIV>
												</FORM>
												<form action="<%=request.getContextPath()%>/manage/terminalInfo/downAllotTemplate" method="post" id="downForm" ></form>

												<!--当中内容块结束-->
									</TD>
								</TR>
								<!--结束-->
							</TABLE></TD>
					</TR>
				</TBODY>
			</TABLE>
		</DIV>
		<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
			<TBODY>
				<TR>
					<TD width="5" bgcolor="#f1fcfe"><IMG width="5" height="5"
						src="<%=request.getContextPath()%>/images/footer_l.jpg">
					</TD>
					<TD bgcolor="#f1fcfe">&nbsp; <br /></TD>
					<TD width="5" bgcolor="#f1fcfe"><IMG width="5" height="5"
						src="<%=request.getContextPath()%>/images/footer_r.jpg">
					</TD>
				</TR>
			</TBODY>
		</TABLE>
		<%@ include file="/jsp/platform/include/foot.jsp"%>
		<script type="text/javascript">
		   	var infos = "<c:out value='${param.infos}'/>";
			var isAdd = "<c:out value='${param.isAdd}'/>";
			var msg = "<c:out value='${param.msg}'/>";
			msg = decodeURI(msg);
			if (infos!=''&& infos=='success') {
			    if(isAdd == "true"){
			       $.messager.alert("提示信息", "终端分配成功");
			    }else{
			       $.messager.alert("提示信息","导入失败,原因如下:<br>"+msg);
			    }
				
			}else if(infos != ''&&infos=='error'){
				$.messager.alert("提示信息", "终端分配失败");
			}
			function submitForm() {
			     var checkStr =   "need|sysAccount|代理商编号|"+ $("#sysAccount").val()+";"
			                     +"need|file|终端文件|"+ $("#file").val()+";"
		                         +"fileType|file|终端文件|"+ $("#file").val()+"|xls;"
		                    ;
		        //检验所有规则
				if (!checkAll(checkStr)) {
					return false;
				}
			    //检验代理商编号是否存在
			    var url = '<%=request.getContextPath()%>/manage/agentInfo/existAgent';
									$.post(
													url,
													{
														'sysAccount' : $("#sysAccount").val()
													},
													function(data) {
														if (data.success) {
														    if(data.msg=="2"){
														      $.messager
																	.alert("提示信息",
																			"代理商不存在，请重新输入!");
														    }else if(data.msg=="1"){
														      $('#terminalInfo').submit();
														    }
														} else {
															$.messager.alert(
																	"提示信息",
																	data.msg);
														}
													});

			}
		</script>
</BODY>
</HTML>
